package com.xbjtech.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.xbjtech.mapper.OrderMapper;
import com.xbjtech.model.Order;
import com.xbjtech.model.OrderExample;
import com.xbjtech.service.OrderService;

@Service
public class OrderServiceImpl implements OrderService {

	@Autowired
	OrderMapper orderMapper;
	
	public void insertOrder(Order order) {
		orderMapper.insert(order);
	}

	public void updateOrder(Order order) {
		orderMapper.updateByPrimaryKeySelective(order);
	}

	public void deleteOrder(Long id) {
		orderMapper.deleteByPrimaryKey(id);
	}

	public Order selectById(Long id) {
		return orderMapper.selectByPrimaryKey(id);
	}

	public List<Order> list(OrderExample example, int page, int pageSize) {
		PageHelper.startPage(page, pageSize);
		List<Order> order = orderMapper.selectByExample(example);
		return order;
	}

}
